<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
 
<isperp:grid url="incident/incident/major/listAllDetail"
	gridId="incidentGrid"   cusDialogSize="maximize"
	sortname="create_date" advanceSearch="true" sortorder="desc"
	keywordFields="code,title,ci_code,cus_user_code,cus_user_name"
	keywordTitle="输入编号/标题/申报人/资产编号"
	ondbClickRowEvent="incidentGrid.view(rowid);" autoReloadGrid="true"
	autoReloadTreeMenu="incidentMenu" 
	cusViewUrl="incident/incident/major/edit" configColumns="true">

	<jsp:attribute name="toolbar">
	<isperp:treeMenu id="incidentMenu" targetGridId="incidentGrid">
		<isperp:async enable="true"></isperp:async>
		<isperp:callback onClick="incidentMenuTree_onNodeClick"
				onAsyncSuccess="incidentMenuTree_onNodeClickFirst();">
		</isperp:callback>
	</isperp:treeMenu>
	 
	</jsp:attribute>

	<jsp:attribute name="searchbar">
	<table class="search-table">
		<tbody>
			<tr>
				<td class="td1">申报人：</td>
				<td class="td2"><input type="text"
						field="cus_user_code,cus_user_name" op="cn" style="width:144px;">
					</td>
				 <td class="td1">编号/标题/资产编号：</td>
				  <td class="td2">
				     <input type="text" style="width:144px;"
						field="code,title,ci_code" op="cn">
				  </td>
				 <td class="td1">创建时间：</td>
				 <td class="td2">
				  <input id="createDateStart" type="date" class="date"
						field="create_date" op="gt" style="width: 68px" />~<input
						id="createDateEnd" class="date" type="date" field="create_date"
						op="lt" style="width: 68px" />
				 </td>
			</tr>
			<tr>
			    <td class="td1">所属系统：</td>
				<td class="td2"><input type="hidden" id="icdCategoryId"
						field="icd_category_name" op="cn" /> <isperp:treeSelector
							displayValueCssStyle="width:144px;" onlySelectLeaf="false"
							url="incident/category/getTree" id="icdCategorySelector"
							name="text" displayValue="" valueColumn="text"
							valueControlId="icdCategoryId"></isperp:treeSelector>
							<a
						onclick="$('#icdCategoryId').val('');$('#icdCategorySelector').val('');"
						class="nui-txt-link ">清除</a>
				</td>
				
				<td class="td1">一线分派人：</td>
				<td class="td2"><input type="text"
						field="distributor_name,distributor_id" style="width:144px;"
						op="cn">

				</td>
				
				<td class="td1">受理时间：</td>
				<td class="td2"><input id="assignDateStart" type="date"
						field="assign_date" op="gt" style="width: 68px" />~<input
						id="assignDateEnd" type="date" field="assign_date" op="lt"
						style="width: 68px" />
					</td>
					
			</tr>
			<tr>
                 <td class="td1">IS担当：</td>
				<td class="td2">
				<input type="text" field="confirmtimeman_name" op="cn"
						style="width:144px;">
				
			    </td>
				<td class="td1">工程师：</td>
				<td class="td2"><input type="text" style="width:144px;"
						field="solver_id,solver_name,supporter_name" op="cn">
				</td>
				
					
					<td class="td1">解决时间：</td>
				<td class="td2"><input id="solvedDateStart" type="date"
						field="solved_date" op="gt" style="width: 68px" />~<input
						id="solvedDateEnd" name="solvedDateEnd" type="date"
						field="solved_date" op="lt" style="width: 68px" />
					</td>
			</tr>
			<tr>
			  <td class="td1">事件性质：</td>
			  <td class="td2" colspan="5">
			     <isperp:dictSelector id="incidentType" multiple="true"
							typeCode="INCIDENT_NATURE" field="incident_type" op="cn"></isperp:dictSelector>
			  </td>
			</tr> 
			<tr>
			  <td class="td1">状态：</td>
			  <td class="td2" colspan="5">
			     <isperp:dictSelector id="status" op="in" name="sttatus"
							checkAll="true" field="status" hasEmptyValue="true"
							typeCode="INCIDENT_STATUS" type="checkbox"></isperp:dictSelector>
			  </td>
			</tr> 
			
		</tbody>
	</table>
	</jsp:attribute>
	<jsp:body>
	<isperp:column name="id" title="" hidden="true"></isperp:column>
	
	<isperp:column name="sla_status" title="" hidden="true"></isperp:column>
	<isperp:column name="priority_name" title="" width="35"
			isFormatterFun="true" formatter="return statusFormatter(rowObject);">
	</isperp:column>
	<isperp:column name="code" title="编号" width="100">
	</isperp:column>
	<isperp:column name="title" title="标题" width="120">
	</isperp:column>
	<isperp:column name="ci_code" title="资产编号" width="80"
			showInHead="false"></isperp:column>
	<isperp:column name="description" title="描述" showInHead="false"
			width="80">
	</isperp:column>
	<isperp:column name="icd_category_name" title="所属系统" width="100"
			showInHead="true">
	</isperp:column>
	<isperp:column name="incident_type" title="性质" width="50">
	</isperp:column>
	<isperp:column name="cus_user_name" title="申报人" width="60">
	</isperp:column>
	<isperp:column name="mobile_short" title="申报人短号" showInHead="false"
			width="80">
	</isperp:column>
	
	<isperp:column name="linkman_name" title="联系人" showInHead="false"
			width="80">
	</isperp:column>
	<isperp:column name="linkman_phone" title="联系人电话" showInHead="false"
			width="80">
	</isperp:column>
	 
	<isperp:column name="expect_time" title="期望完成时间" showInHead="false"
			width="80">
	</isperp:column>
	<isperp:column name="address_name" title="位置" showInHead="false"
			width="80">
	</isperp:column>
	<isperp:column name="address_detail" title="柱子/区域" showInHead="false"
			width="80">
	</isperp:column>
	<isperp:column name="service_category_name" title="服务目录"
			showInHead="false" width="80">
	</isperp:column>
	<isperp:column name="create_date" title="登记时间" width="100"
			showInHead="true">
	</isperp:column>
	<isperp:column name="assign_date" title="受理时间" width="100"
			showInHead="true">
	</isperp:column>

		<isperp:column name="supporter_name" title="工程师" width="60"
			showInHead="true">
	</isperp:column>

	<isperp:column name="status" title="状态" width="80"
			isFormatterFun="true"
			formatter="return statusNameFormatter(rowObject);">
	</isperp:column>
	
	</jsp:body>
</isperp:grid>

<isperp:operate code="INC_HANDLE"></isperp:operate>

<script type="text/javascript">
	function statusFormatter(rowObject) {
		var p = 0, html = "", title = "";
		if (rowObject.priority_name != null) {

			switch (rowObject.priority_name) {
			case "一级":
				p = 1;
				break;
			case "二级":
				p = 2;
				break;
			case "三级":
				p = 3;
				break;
			case "四级":
				p = 4;
				break;
			case "五级":
				p = 5;
				break;

			}
			title = "优先级：" + p + "级";
		} else {
			rowObject.priority_name = "未确定优先级";
			title = "未确定优先级";
		}

		html = "<img title='"+title+"' src='img/incident/p"+p+".png'>";
		if (rowObject.sla_status == 1) {

			html = html + "&nbsp;<img title='SLA：异常'  src='img/incident/sla_unusual.png'>";
		}

		return html + "&nbsp;<a id='msg_" + rowObject.id + "' href=\"javascript:openRelationMessage('" + rowObject.id + "')\" class=''></a>";
	}

	function openRelationMessage(id) {

		isperp.openDialog({
			title : "查看消息",
			contentUrl : "app/message/relationMessageView?all=1&sourceId=" + id
		});
	}

	function statusNameFormatter(rowObject) {
		title = "";
		if (rowObject.status != null && rowObject.status == '已解决') {

			if (rowObject.are_feedback != null && rowObject.are_feedback) {
				title = rowObject.status + "【已评价】";
			} else {
				title = rowObject.status + "【未评价】";
			}
		} else {
			title = rowObject.status;
		}
		return title;
	}
</script>